package com.demo2;

/**
 * Colleague 同事  抽象类
 * @author zhoujun
 * @date 2025/3/26 23:25
 */
public abstract class Colleague {

    /**
     * 中介者对象
     */
    protected Mediator mediator;

    public Colleague(Mediator mediator) {
        this.mediator = mediator;
//        mediator.register(this); //把注册工作交给客户端
    }

    public void  send(String message){
        mediator.relay(this,message);
    }

    abstract void receive(String message);
}
